﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DocumentStorage.EFRepository.Interfaces;
using DocumentStorage.EFRepository.Repositories;
using DocumentStorage.Services.Interfaces;
using DocumentStorage.Services.Services;
using Ninject.Activation;
using Ninject.Modules;

namespace DocumentStorage.IntegrationTests
{
  public class IntegrationTestModule : NinjectModule
  {
    public override void Load()
    {
      Bind<IDocumentPersistanceService>().To<DocumentStorage.Services.Services.DocumentPersistanceService>();
      Bind<IDocumentRepository>().ToProvider(new IntegrationTestRepositoryProvider());
    }
  }

  public class IntegrationTestRepositoryProvider : Provider<IDocumentRepository>
  {
    protected override IDocumentRepository CreateInstance(IContext context)
    {
        return new DocumentRepository(ConfigurationManager.ConnectionStrings["connectionString"].ToString());
    }
  }
}
